home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-15 | 9.3 KB | 255 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // UTwistDownApp.h
- // ETO20 MacApp 3.3.1, MPW 3.4.1
- // Copyright ©1994-1996 Conrad Kopala
- // Twist Down Lists version 2.0a0 7/15/96
- //----------------------------------------------------------------------------------------
-
- #ifndef __UTWISTDOWNAPP__
- #define __UTWISTDOWNAPP__
-
- #ifndef __UVOLUMEBASEDAPP__
- #include "UVolumeBasedApp.h"
- #endif
-
- #ifndef __UVOLUME__
- #include "UVolume.h"
- #endif
-
- #ifndef __UTWISTDOWNGLOBALS__
- #include "UTwistDownGlobals.h" //Required for EAppleEventRouting
- #endif
-
- //MacApp stuff
- #ifndef __UAPPLICATION__
- #include "UApplication.h"
- #endif
-
- #ifndef __ULIST__
- #include "UList.h"
- #endif
-
- #ifndef __ULISTITERATOR__
- #include "UListIterator.h"
- #endif
-
- #ifndef __UMACAPPGLOBALS__
- #include "UMacAppGlobals.h"
- #endif
-
- #ifndef __UCOMMAND__
- #include "UCommand.h"
- #endif
-
- //ToolBox stuff
- #ifndef __QUICKDRAW__
- #include "Quickdraw.h"
- #endif
-
- //ANSI stuff
- //None
- //----------------------------------------------------------------------------------------
- // Forward and external classes
- //----------------------------------------------------------------------------------------
- class TWindow; //external
- class TTwistDownApp; //forward - required because CWindowsMenuListIterator uses it
- class TTwistDownElement; //external
-
- #if qDebug
- class TResetObjectCountCommand; //forward
- #endif
- //----------------------------------------------------------------------------------------
- // CWindowsMenuListIterator
- //----------------------------------------------------------------------------------------
- class CWindowsMenuListIterator : public CObjectIterator
- {
- public:
- CWindowsMenuListIterator::CWindowsMenuListIterator(TTwistDownApp* itsApplication,
- ArrayIndex itsLowBound, ArrayIndex itsHighBound,
- Boolean itsForward);
-
- CWindowsMenuListIterator::CWindowsMenuListIterator(TTwistDownApp* itsApplication, Boolean itsForward);
-
- CWindowsMenuListIterator::CWindowsMenuListIterator(TTwistDownApp* itsApplication);
-
- virtual ~CWindowsMenuListIterator();
-
- TWindow* CWindowsMenuListIterator::CurrentWindow();
- // returns the current Window
-
- TWindow* CWindowsMenuListIterator::FirstWindow();
- // return the first Window in the iteration
-
- TWindow* CWindowsMenuListIterator::NextWindow();
- // advances the iteration and then returns the Window
- };
- //----------------------------------------------------------------------------------------
- // TVolumesCommand: Retrieves a list of Volumes from an AppleEvent Abstract class for
- // TOVolumeCommand. Analog of TFilesCommand.
- //----------------------------------------------------------------------------------------
- class TVolumesCommand : public TServerCommand
- {
- MA_DECLARE_CLASS;
-
- public:
- TList* fVolumeList;
-
- TVolumesCommand::TVolumesCommand();
- virtual ~TVolumesCommand();
- void TVolumesCommand::IVolumesCommand(CommandNumber itsCommandNumber, TList* theDocuments);
- void TVolumesCommand::IVolumesCommand(CommandNumber itsCommandNumber, const AppleEvent& itsMessage,
- const AppleEvent& itsReply);
- void TVolumesCommand::GetVolumesList();
- };
- //----------------------------------------------------------------------------------------
- // TOVolumeCommand: Accepts a list of volume aliases and opens each of them
- // Analog of TODocCommand.
- //----------------------------------------------------------------------------------------
- class TOVolumeCommand : public TVolumesCommand
- {
- MA_DECLARE_CLASS;
-
- public:
- TOVolumeCommand::TOVolumeCommand();
- virtual ~TOVolumeCommand();
- void TOVolumeCommand::IOVolumeCommand(CommandNumber itsCommandNumber, TList* theDocuments);
- void TOVolumeCommand::IOVolumeCommand(CommandNumber itsCommandNumber, const AppleEvent& itsMessage,
- const AppleEvent& itsReply);
- virtual void TOVolumeCommand::DoIt();
- virtual TAppleEvent* TOVolumeCommand::MakeAppleEvent();
- };
- //----------------------------------------------------------------------------------------
- // TOpenVolumeCommand: Accepts a single instance of TVolume and opens it.
- // Analog of TODocCommand. - old version, not used
- //----------------------------------------------------------------------------------------
- class TOpenVolumeCommand : public TCommand
- {
- MA_DECLARE_CLASS;
-
- public:
- TVolume* fVolume;
-
- TOpenVolumeCommand::TOpenVolumeCommand();
- virtual ~TOpenVolumeCommand();
- void TOpenVolumeCommand::IOpenVolumeCommand(CommandNumber itsCommandNumber, TVolume* aVolume);
- virtual void TOpenVolumeCommand::DoIt();
- };
-
-
- #if qDebug
- //----------------------------------------------------------------------------------------
- // TResetObjectCountCommand:
- //----------------------------------------------------------------------------------------
- class TResetObjectCountCommand : public TServerCommand
- {
- MA_DECLARE_CLASS;
-
- public:
-
- TResetObjectCountCommand::TResetObjectCountCommand();
- virtual ~TResetObjectCountCommand();
- void TResetObjectCountCommand::IResetObjectCountCommand();
- void TResetObjectCountCommand::IResetObjectCountCommand(const AppleEvent& itsMessage, const AppleEvent& itsReply);
- virtual TAppleEvent* TResetObjectCountCommand::MakeAppleEvent();
- virtual void TResetObjectCountCommand::DoIt();
- };
- #endif
-
- //----------------------------------------------------------------------------------------
- // TSplashScreenCommand:
- //----------------------------------------------------------------------------------------
- class TSplashScreenCommand : public TCommand
- {
- MA_DECLARE_CLASS;
-
- public:
- TWindow* fSplashScreenWindow;
-
- TSplashScreenCommand::TSplashScreenCommand();
- virtual ~TSplashScreenCommand();
- void TSplashScreenCommand::ISplashScreenCommand(CommandNumber itsCommandNumber);
- virtual void TSplashScreenCommand::DoIt();
- };
-
-
- //----------------------------------------------------------------------------------------
- // TTwistDownApp
- //----------------------------------------------------------------------------------------
- class TTwistDownApp: public TApplication, public MVolumeBasedApp
- {
- MA_DECLARE_CLASS;
-
- public:
- Boolean fHasSplashScreen;
- TList* fWindowsMenuList;
- Boolean fShowInvisibleFiles;
- Boolean fAllowUnlimitedDocs;
-
- //The following fields are used to manage memory.
- short fTDElementClassSize; //the class size of TTwistDownElement
- short fTDControlClassSize; //the class size of TTwistDownControl
-
- TTwistDownApp::TTwistDownApp();
- virtual ~TTwistDownApp();
- virtual void TTwistDownApp::ITwistDownApp(Boolean hasSplashScreen);
-
- //This application is distinctly un-Mac-like because the same volume can be opened repeatedly by
- //setting fAllowUnlimitedDocs = TRUE which can be done by exercising the menu command
- //cAllowUnlimitedDocs. Since TTwistDownDocument is never saved, that is not a problem.
- //From a debugging point of view it is convenient to be able to repeatedly open the same test disk.
- //But then, the items in the Windows menu all have the same name which can be confusing.
- //Therefore, volumes with the same name get numbered so you can tell which is which.
- //The following method helps by scanning the document list and returning a count of the number
- //of documents with the same name plus one, ie. the next document number. By the way, scripting
- //support requires that documents have unique names. GetNextDocumentNumber is called by
- //TTwistDownDocument::SetVolumeData.
-
- short TTwistDownApp::GetNextDocumentNumber(const CStr31& volumeName);
-
- TDocument* TTwistDownApp::FindDocument(TVolume* aVolume); //overloaded
- TDocument* TTwistDownApp::DoMakeDocument(CommandNumber aCommandNumber, TVolume* itsVolume); //overloaded
-
- virtual void TTwistDownApp::DoSetupMenus();
- virtual void TTwistDownApp::DoMenuCommand(CommandNumber aCommandNumber);
-
- //these add and delete windows to/from fWindowsMenuList
- //they are called by whoever opens/closes windows
- void TTwistDownApp::AddWindowToWindowsMenuList(TWindow* windowToAdd);
- void TTwistDownApp::RemoveWindowFromWindowsMenuList(TWindow* windowToRemove);
- short TTwistDownApp::CountWindowsInList();
-
- TWindow* TTwistDownApp::DoMakeSplashScreen();
-
- TWindow* TTwistDownApp::DoMakeAboutBox();
- virtual void TTwistDownApp::DoAboutBox();
-
- virtual void TTwistDownApp::GetStandardFileParameters(CommandNumber itsCommandNumber, ProcPtr& fileFilter,
- TypeListHandle& typeList, short& dlgID,CPoint& where,ProcPtr& dlgHook,
- ProcPtr& modalFilter,Ptr& activeList,ProcPtr& activateProc,
- StandardFileReply* reply,void*& yourDataPtr);
-
- virtual void TTwistDownApp::DoOpen(CommandNumber theCmdNumber);
-
- //Scripting Support
- virtual void TTwistDownApp::DoScriptCommand(CommandNumber aCommandNumber, TAppleEvent* message, TAppleEvent* reply);
- virtual long TTwistDownApp::CountContainedObjects(DescType desiredType);
- virtual MScriptableObject* TTwistDownApp::GetContainedObject(DescType desiredType,
- DescType selectionForm, const CAEDesc& selectionData);
-
- virtual void TTwistDownApp::SetObjectProperty(const CAEDesc& thePropertyValue,DescType whichProperty);
-
- virtual void TTwistDownApp::GetSetPropertyInfo(DescType whichProperty,CommandNumber& cmdNum,Boolean& canUndo,
- Boolean& causesChange,TCommandHandler* &theContext);
-
- virtual Boolean TTwistDownApp::GetObjectProperty(CAEDesc& thePropertyValue,
- DescType whichProperty,const CAEDesc& desiredType);
-
- };
- //----------------------------------------------------------------------------------------
- // Globals defined by this unit
- //----------------------------------------------------------------------------------------
-
- extern TTwistDownApp* gTwistDownApp;
-
- #endif
-